<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    protected $san=30;
    protected $cahce=86400;//缓存时间 //一天
    
    public function index(){
        $this->url=ACTION_NAME;
        if(!S('list_index')){
            //如果没有缓存，就写缓存
            $list=array();
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            $list['menu_top']=Home2017Controller::menu(56);
            $list['guzal_suez']=Home2017Controller::guzal_suez(53,"",0,14);
            $list['home_news']=Home2017Controller::home_news(52,"",0,9,"id,title,status,intime,thumb");
            //xahislar toplimi
            $list['person_news']=Home2017Controller::home_news(53,"",0,6,"id,title,status,intime,thumb,standby1");
            //alaka toplimi
            $list['contact_news']=Home2017Controller::home_news(54,"",0,6,"id,title,status,intime,thumb");
            //toplam wa kanun
            $list['law_news']=Home2017Controller::home_news(55,"",0,6,"id,title,status,intime,thumb");
            //bazar
            $list['shop']=Home2017Controller::home_news(56,"",0,8,"id,title,status,intime,thumb,summer");
            $list['bottom_menu']=Home2017Controller::menu(60);
            S('list_index',$list,$this->cahce);
            //如果是手机
            if(isMobile()){
                $list['home_news']=array_slice($list['home_news'],"0","6");
                $list['person_news']=array_slice($list['person_news'],"0","6");
                $list['contact_news']=array_slice($list['contact_news'],"0","5");
                $list['law_news']=array_slice($list['law_news'],"0","6");
                $list['shop']=array_slice($list['shop'],"0","6");
            }
        }else{
            //如果有缓存就从缓存模板读出来
            $list=S('list_index');
            //如果是手机
            if(isMobile()){
                $list['home_news']=array_slice($list['home_news'],"0","6");
                $list['person_news']=array_slice($list['person_news'],"0","6");
                $list['contact_news']=array_slice($list['contact_news'],"0","5");
                $list['law_news']=array_slice($list['law_news'],"0","6");
                $list['shop']=array_slice($list['shop'],"0","6");
            }
        }
        $this->assign('list',$list);
        $this->display('index');
    }
    public function video(){
        $this->url=ACTION_NAME;
        $list=array();
        $list['menu_top']=Home2017Controller::menu(56);
        $list['banner_ad']=Home2017Controller::banner_ad(40);
        $this->assign('list',$list);
        $this->display('video');
    }
    public function person(){
        $this->catid=53;
        $this->url=ACTION_NAME;
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //判断又没有缓存
        if(!S('person'.$this->get_page)) {
            $list = array();
            $list['menu_top'] = Home2017Controller::menu(56);
            $list['banner_ad'] = Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['person_cat'] = Home2017Controller::_category_id_url(53, "personlist");
            //分页
            $list['count'] = count(Home2017Controller::home_news(53, "", '', '', "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //xahislar toplimi
            $list['person_news'] = Home2017Controller::home_news(53, "",$Page->firstRow, $Page->listRows, "id,title,status,intime,thumb,standby1,pid");
            $list['bottom_menu'] = Home2017Controller::menu(60);
            //写缓存
            S('person'.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('person'.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display('person');
    }
    public function personlist(){
        $catid=I('get.catid');
        $this->url="person";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //判断又没有缓存
        if(!S('personlist'.$catid.$this->get_page)) {
            $list = array();
            $list['menu_top'] = Home2017Controller::menu(56);
            $list['banner_ad'] = Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['person_cat'] = Home2017Controller::_category_id_url(53, "personlist");
            //okuxluk bala sahipa
            $list['bala_cat'] = Home2017Controller::_category_id_url($catid, "personlist/" . $catid);
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid, "", '', '', "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //xahislar toplimi
            $list['person_news'] = Home2017Controller::home_news($catid, "", $Page->firstRow, $Page->listRows, "id,title,status,intime,thumb,standby1");
            $list['bottom_menu'] = Home2017Controller::menu(60);
            $list['catid'] = $catid;
            //写缓存
            S('personlist'.$catid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('personlist'.$catid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("personlist");
    }
    public function personchild(){
        $catid=I('get.catid');
        $childid=I('get.childid');
        $this->url="person";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //有没有缓存
        if(!S('personchild'.$catid.$childid.$this->get_page)) {
            $list = array();
            $list['menu_top'] = Home2017Controller::menu(56);
            $list['banner_ad'] = Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['person_cat'] = Home2017Controller::_category_id_url(53, "personlist");
            //bala tur anisi  sahipa
            $list['bala_ana_cat'] = Home2017Controller::_category_bala_ana_id($childid, "personlist/" . $catid);
            //okuxluk bala hamma
            $list['bala_cat_hamma'] = Home2017Controller::_category_id_url(169, "personlist/" . $catid, false);
            //okuxluk bala sahipa
            $list['bala_cat'] = Home2017Controller::_category_id_url($childid, "personlist/" . $catid);
            //分页
            $list['count'] = count(Home2017Controller::home_news($childid, "", '', '', "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //xahislar toplimi
            $list['bottom_menu'] = Home2017Controller::menu(60);
            $list['person_news'] = Home2017Controller::home_news($childid, "", $Page->firstRow, $Page->listRows, "id,title,status,intime,thumb,standby1");
            $list['catid'] = $catid;
            $list['childid'] = $childid;
            //写缓存、
            S('personchild'.$catid.$childid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('personchild'.$catid.$childid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("personchild");
    }
    public function contact(){
        $catid=54;
        $this->url=ACTION_NAME;
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        if(!S("contact".$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['contact_cat']=Home2017Controller::_category_id_url($catid,"contactlist");
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid, "", '', '', "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //alaka toplimi
            $list['contact_news']=Home2017Controller::home_news(54,"",'','',"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=  $catid;
            //写缓存
            S("contact".$this->get_page,$list,$this->cahce);
        }else{
            $list= S("contact".$this->get_page);
            
        }
        $this->assign('list',$list);
        $this->display('contact');
    }
    public function contactlist(){
        $catid=I('get.catid');
        $this->url="contact";
        $list=array();
        $list['menu_top']=Home2017Controller::menu(56);
        $list['banner_ad']=Home2017Controller::banner_ad(40);
        //okuxluk qong sahipa
        $list['contact_cat']=Home2017Controller::_category_id_url(54,"contactlist");
        //okuxluk bala sahipa
        $list['bala_cat']=Home2017Controller::_category_id_url($catid,"contactlist/".$catid);
        //alaka toplimi
        $list['contact_news']=Home2017Controller::home_news($catid,"",'','',"id,title,status,intime,thumb");
        $list['bottom_menu']=Home2017Controller::menu(60);
        $this->assign('list',$list);
        $this->assign('catid',$catid);
        $this->display("contactlist");
    }
    public function contactchild(){
        $catid=I('get.catid');
        $childid=I('get.childid');
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        $this->url="contact";
        //判断有没有缓存文件，如果有的话就读出来缓存
        if(!S("contactchild".$catid.$childid.$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['contact_cat']=Home2017Controller::_category_id_url(54,"contactlist");
            //okuxluk bala sahipa
            $list['bala_cat']=Home2017Controller::_category_id_url($childid,"contactlist/".$catid);
//        p($list['bala_cat']);die;
            //bala tur anisi  sahipa
            $list['bala_ana_cat']=Home2017Controller::_category_bala_ana_id($childid,"contactlist/".$catid);
            //okuxluk bala hamma
            $list['bala_cat_hamma']=Home2017Controller::_category_id_url(70,"contactlist/".$catid,false);
            //分页
            $list['count'] = count(Home2017Controller::home_news($childid, "", '', '', "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //alaka toplimi
            $list['contact_news']=Home2017Controller::home_news($childid,"",'','',"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            $list['childid']=$childid;
            //如果没有缓存，就写
            S("contactchild".$catid.$childid.$this->get_page,$list,$this->cahce);
        }  else{
            $list= S("contactchild".$catid.$childid.$this->get_page);
        }

        $this->assign('list',$list);
        $this->display("contactchild");
    }
    public function law(){
        $this->catid=55;
        $this->url=ACTION_NAME;
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //判断又没有缓存
        if(!S('law'.$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['law_cat']=Home2017Controller::_category_id_url(55,"lawlist");
            //分页
            $list['count'] = count(Home2017Controller::home_news(55,"",'','',"id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //alaka toplimi
            $list['contact_news']=Home2017Controller::home_news(55,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            //写缓存
            S('law'.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('law'.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display('law');
    }
    public function lawlist(){
        $catid=I('get.catid');
        $this->url="law";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        if(!S('lawlist'.$catid.$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['law_cat']=Home2017Controller::_category_id_url(55,"lawlist");
            //okuxluk bala sahipa
            $list['bala_cat']=Home2017Controller::_category_id_url($catid,"lawlist/".$catid,false);
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid,"",'','',"id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //alaka toplimi
            $list['law_news']=Home2017Controller::home_news($catid,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            //写缓存
            S('lawlist'.$catid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('lawlist'.$catid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("lawlist");
    }
    public function lawchild(){
        $catid=I('get.catid');
        $childid=I('get.childid');
        $this->url="law";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //有没有缓存
        if(!S('lawchild'.$catid.$childid.$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['law_cat']=Home2017Controller::_category_id_url(55,"lawlist");
            //bala tur anisi  sahipa
            $list['bala_ana_cat']=Home2017Controller::_category_bala_ana_id($childid,"lawlist/".$catid);
//        //okuxluk bala hamma
            $list['bala_cat_hamma']=Home2017Controller::_category_id_url($catid,"lawlist/".$catid,false);
            //okuxluk bala sahipa
            $list['bala_cat']=Home2017Controller::_category_id_url($childid,"lawlist/".$catid);
            //分页
            $list['count'] = count(Home2017Controller::home_news($childid,"",'','',"id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //alaka toplimi
            $list['law_news']=Home2017Controller::home_news($childid,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            //alaka toplimi
            $list['law_news']=Home2017Controller::home_news($childid,"",'','',"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            $list['childid']=$childid;
            //写缓存
            S('lawchild'.$catid.$childid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('lawchild'.$catid.$childid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("lawchild");
    }

    public function view(){
        $ip=ip2long(get_client_ip());
        if(IS_AJAX){
            $ajax_post=I('post.');
            $no_ok=$this->ajax_favour($ajax_post['id'],$ip);
            if(!$no_ok){
                $data['newsid']=$ajax_post['id'];
                $data['ip']=$ip;
                M("like")->add($data);
                $row=M("article")->where("id=".$ajax_post['id'])->setInc("favour",1);
                if($row){
                    $data=array("status"=>0);
                }else{
                    $data=array("status"=>1);
                }
                $this->ajaxReturn($data);
            }
        }
        //
        $id=I('get.id');
        $this->url=ACTION_NAME;
        if(!S("view".$id)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //kuerux bat
            $list['news_view']=Home2017Controller::news_view($id);
            //catids
            $list['catids']=array_slice($list['news_view']['catids'],-3,1);
            //点击量，不是点赞
            M("article")->where("id=".$id)->setInc("click",1);
            //手机时分享给别人
            if(isMobile()){
                $list['biaoti'] =$list['news_view']['title'];
            }
            if(!$list['news_view']['title']){
                header("location:/index.shtml");
                exit;
            }
            //点赞 ，判断这个ip是否已经点赞
            $no_ok=$this->ajax_favour($id,$ip);
            //如果已经点了赞，那就返回 0 ，否则返回 1
            $list['favnum']=$no_ok?0:1;
            //点赞总数
            $list['like']=Home2017Controller::news_favour($id);
            //tag
            $list['news_tag']=Home2017Controller::news_tag($id);
            //manba
            $list['source']=Home2017Controller::source($id);
            //yantarap , bularnimu yahturisiz
            $list['view_news']=Home2017Controller::view_news($id,"",0,6,"id,title,status,intime,thumb,pid","intime desc");
            shuffle($list['view_news']);
            //inkas
            $list['comment']=Home2017Controller::comment($id);
            $list['bottom_menu']=Home2017Controller::menu(60);
            //写缓存
            S("view".$id,$list,$this->cahce);
        }else{
            $list=S("view".$id);
            shuffle($list['view_news']);
            //点赞 ,判断这个ip是否已经点赞
            $no_ok=$this->ajax_favour($id,$ip);
            //如果已经点了赞，那就返回 0 ，否则返回 1
            $list['favnum']=$no_ok?0:1;
            //点赞总数
            $list['like']=Home2017Controller::news_favour($id);
            //点击量，不是点赞
            M("article")->where("id=".$id)->setInc("click",1);
        }
        $this->assign('list',$list);
        $this->display("view");
    }
    public  function ajax_favour($id,$ip){
        $row=M("like")->where("newsid='$id' and ip='$ip'")->select();
        return $row;
    }
    //hawar bat
    public function okuxluk(){
        $this->catid=52;
        $this->url=ACTION_NAME;
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        if(!S('okuxluk'.$this->get_page) ){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['okuxluk_cat']=Home2017Controller::_category_id_url(52,"turlist");
            //分页
            $list['count'] = count(Home2017Controller::home_news(52,"","","","id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //hawar qikirix
            $list['okuxluk_news']=Home2017Controller::home_news(52,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            //写缓存、\
            S('okuxluk'.$this->get_page,$list,$this->cahce);
        }else{
            //如果有缓存，就获取缓存
            $list=S('okuxluk'.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("okuxluk");
    }
    //tur bat
    public function turlist(){
        $catid=I('get.catid');
        $this->url="okuxluk";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //判断有没有缓存
        if(!S('turlist'.$catid.$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['okuxluk_cat']=Home2017Controller::_category_id_url(52,"turlist",false);
            //okuxluk bala sahipa
            $list['bala_cat']=Home2017Controller::_category_id_url($catid,"turlist/".$catid,false);
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid,"","","","id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //sahipaga asasan hawar qikirix
            $list['okuxluk_tur']=Home2017Controller::home_news($catid,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            //写缓存
            S('turlist'.$catid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('turlist'.$catid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("turlist");
    }
    public function turchild(){
        $catid=I('get.catid');
        $childid=I('get.childid');
        $this->url="okuxluk";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //有没有缓存
        if(!S('turchild'.$catid.$childid.$this->get_page)){
            $list=array();
            $list['childid']=$childid;
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['okuxluk_cat']=Home2017Controller::_category_id_url(52,"turlist");
            //bala tur anisi  sahipa
            $list['bala_ana_cat']=Home2017Controller::_category_bala_ana_id($childid,"turlist/".$catid);
            //okuxluk bala hamma
            $list['bala_cat_hamma']=Home2017Controller::_category_id_url($catid,"turlist/".$catid,false);
            //okuxluk bala sahipa
            $list['bala_cat']=Home2017Controller::_category_id_url($childid,"turlist/".$catid);
            //分页
            $list['count'] = count(Home2017Controller::home_news($childid,"","","","id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //sahipaga asasan hawar qikirix
            $list['okuxluk_tur']=Home2017Controller::home_news($childid,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            //如果没有缓存就写
            S('turchild'.$catid.$childid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('turchild'.$catid.$childid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("turchild");
    }
    //rasim bat
    public function image(){
        $catid=444;
        $this->url=ACTION_NAME;
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        if(!S('image'.$this->get_page) ){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['image_cat']=Home2017Controller::_category_id_url($catid,"imagelist");
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid,"","","","id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //hawar qikirix
            $list['image_news']=Home2017Controller::home_news($catid,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            //写缓存、\
            S('image'.$this->get_page,$list,$this->cahce);
        }else{
            //如果有缓存，就获取缓存 
            $list=S('image'.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("image");
    }
    //rasim kuerux
    public function imagelist(){
        $catid=I('get.catid');
        $this->url="image";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //判断有没有缓存
        if(!S('imagelist'.$catid.$this->get_page)){
            $list=array();
            $list['menu_top']=Home2017Controller::menu(56);
            $list['banner_ad']=Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['image_cat']=Home2017Controller::_category_id_url(444,"imagelist",false);
            //okuxluk bala sahipa
            $list['bala_cat']=Home2017Controller::_category_id_url($catid,"imagelist/".$catid,false);
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid,"","","","id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'],$this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num']=ceil($list['count']/$this->san);
            $Page->rollPage=7;
            $Page->setConfig('next','كىيىنكى بەت');
            $Page->setConfig('prev','ئالدىنقى بەت');
            $list['page']       = $Page->show();// 分页显示输出
            //sahipaga asasan hawar qikirix
            $list['image_tur']=Home2017Controller::home_news($catid,"",$Page->firstRow,$Page->listRows,"id,title,status,intime,thumb");
            $list['bottom_menu']=Home2017Controller::menu(60);
            $list['catid']=$catid;
            //写缓存
            S('imagelist'.$catid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('imagelist'.$catid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("imagelist");
    }
    //setix bax bat
    public function shop(){
        $this->url=ACTION_NAME;
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        if(!S('shop'.$this->get_page) ) {
            $list = array();
            $list['menu_top'] = Home2017Controller::menu(56);
            $list['banner_ad'] = Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['shop_cat'] = Home2017Controller::_category_id_url(56, "shoplist");
            //分页
            $list['count'] = count(Home2017Controller::home_news(56, "", "", "", "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //bazar
            $list['shop'] = Home2017Controller::home_news(56, "", $Page->firstRow, $Page->listRows, "id,title,status,intime,thumb,summer");
            $list['bottom_menu'] = Home2017Controller::menu(60);
            //写缓存
            S('shop'.$this->get_page,$list,$this->cahce);
        }else{
           $list= S('shop'.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("shop");
    }
    //setix bax bat
    public function shoplist(){
        $catid=I('get.catid');
        $this->url="shop";
        $this->get_page=isset($_GET['p'])?I('get.p'):1;
        //判断有没有缓存
        if(!S('shoplist'.$catid.$this->get_page)) {
            $list = array();
            $list['menu_top'] = Home2017Controller::menu(56);
            $list['banner_ad'] = Home2017Controller::banner_ad(40);
            //okuxluk qong sahipa
            $list['shop_cat'] = Home2017Controller::_category_id_url(56, "shoplist", false);
            //okuxluk bala sahipa
            $list['bala_cat'] = Home2017Controller::_category_id_url($catid, "shoplist/" . $catid, false);
            //分页
            $list['count'] = count(Home2017Controller::home_news($catid, "", "", "", "id"));// 查询满足要求的总记录数
            $Page = new \Think\Page($list['count'], $this->san);// 实例化分页类 传入总记录数和每页显示的记录数(25)
            $list['num'] = ceil($list['count'] / $this->san);
            $Page->rollPage = 7;
            $Page->setConfig('next', 'كىيىنكى بەت');
            $Page->setConfig('prev', 'ئالدىنقى بەت');
            $list['page'] = $Page->show();// 分页显示输出
            //bazar
            $list['shop'] = Home2017Controller::home_news($catid, "", $Page->firstRow, $Page->listRows, "id,title,status,intime,thumb,summer");
            $list['bottom_menu'] = Home2017Controller::menu(60);
            $list['catid']=$catid;
            //写缓存
            S('shoplist'.$catid.$this->get_page,$list,$this->cahce);
        }else{
            $list=S('shoplist'.$catid.$this->get_page);
        }
        $this->assign('list',$list);
        $this->display("shoplist");
    }
    //setix bax bat
    public function shop_show(){
        $this->url=ACTION_NAME;
        $list=array();
        $list['menu_top']=Home2017Controller::menu(56);
        $list['banner_ad']=Home2017Controller::banner_ad(40);
        $list['bottom_menu']=Home2017Controller::menu(60);
        $this->assign('list',$list);
        $this->display("shop_show");
    }

    //inkas
    public function comment(){
        if(IS_AJAX){
            $post=I('post.');
            $post['intime']=time();
            $post['status']=0;
            $post['ip']=get_client_ip();
            $row=M("comment")->add($post);
            if($row){
                $data=array("status"=>1,"message"=>"ئىنكاسىڭىز يوللاندى ، تەستىقلانغاندىن كىيىن كۆرۈنىدۇ ");
            }else{
                $data=array("status"=>1,"message"=>"ئىنكاس يوللاش مەغلۇب بولدى ، قايتا سىناپ بېقىڭ! ");
            }
            $this->ajaxReturn($data);
        }
    }
}